package com.longrise.android.loaddata.newloaddata;

import android.content.Context;
import android.os.Handler;

import com.longrise.android.loaddata.ObserverCallBack;

import org.apache.http.HttpResponse;

import java.io.File;
import java.util.Map;

/**
 * Created by chengsan on 17/6/7.
 */

public abstract class HttpRunnableFather implements Runnable
{
    //版本
    public String appVersion;
    //请求方式
    public int requestType = 2;
    //回调接口
    public ObserverCallBack callBack;
    //获取CookID回调接口
    public OnCookIDListener onCookIDListener;
    //URL
    public String url;
    //参数集合
    public Map<String, String> map;
    //返回结果
    public String resultString;
    public String cookID;
    public HttpResponse httpResponse;
    public Handler handler = null;

    //是否判断缓存数据
    public boolean loadCache = false;
    public Context context;
    public String cacheDic;
    public int mobileTimeOut;
    public int wifiTimeOut;
    //请求连接超时时间,单位：毫秒
    public int connectTimeOut = -1;
    //读取数据超时时间
    public int soTimeOut = -1;
    public File file;//上传的文件对象
    public String fileKey;//文件对应的Key值
    public String mimeType;//文件类型

    //====================GET()/SET()========================
    public void setAppVersion(String appVersion)
    {
        this.appVersion = appVersion;
    }

    public void setRequestType(int requestType)
    {
        this.requestType = requestType;
    }

    public void setCallBack(ObserverCallBack callBack)
    {
        this.callBack = callBack;
    }

    public void setUrl(String url)
    {
        this.url = url;
    }

    public void setMap(Map<String, String> map)
    {
        this.map = map;
    }

    public void setCookID(String cookID)
    {
        this.cookID = cookID;
    }

    public void setOnCookIDListener(OnCookIDListener onCookIDListener)
    {
        this.onCookIDListener = onCookIDListener;
    }

    public void setLoadCache(boolean loadCache)
    {
        this.loadCache = loadCache;
    }

    public void setCacheDic(String cacheDic)
    {
        this.cacheDic = cacheDic;
    }

    public void setContext(Context context)
    {
        this.context = context;
    }

    public void setMobileTimeOut(int mobileTimeOut)
    {
        this.mobileTimeOut = mobileTimeOut;
    }

    public void setWifiTimeOut(int wifiTimeOut)
    {
        this.wifiTimeOut = wifiTimeOut;
    }

    public void setHandler(Handler handler) {
        this.handler = handler;
    }

    public void setConnectTimeOut(int connectTimeOut) {
        this.connectTimeOut = connectTimeOut;
    }

    public void setSoTimeOut(int soTimeOut) {
        this.soTimeOut = soTimeOut;
    }

    public void setFile(File file) {
        this.file = file;
    }

    public void setFileKey(String fileKey) {
        this.fileKey = fileKey;
    }

    public void setMimeType(String mimeType) {
        this.mimeType = mimeType;
    }
}
